package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.rm.zeyou.entity.Technician;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.TechnicianPayoutDetailService;
import com.rm.zeyou.util.login.TechnicianLoginUtil;
import com.rm.zeyou.vo.request.SelectUserPayoutIndexVo;
import com.rm.zeyou.vo.response.ConfirmPayoutResponseVo;
import com.rm.zeyou.vo.response.SelectUserPayoutIndexResponseVo;
import com.rm.zeyou.vo.response.UserPayoutVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用户提现表 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-03-12 15:55:09
 */
@Api(tags = "技师提现相关")
@RestController
@RequestMapping("/api/technicianPayoutDetail")
public class TechnicianPayoutDetailController {
    @Resource
    private TechnicianPayoutDetailService technicianPayoutDetailService;
    @Resource
    private TechnicianLoginUtil technicianLoginUtil;


    @ApiOperation("技师提现页面")
    @PostMapping("selectTechnicianPayoutIndex")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<SelectUserPayoutIndexResponseVo> selectTechnicianPayoutIndex(@RequestBody SelectUserPayoutIndexVo requestVo){
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianPayoutDetailService.selectTechnicianPayoutIndex(technician,requestVo);
    }


    @ApiOperation("技师提现")
    @PostMapping("technicianPayout")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<Integer> technicianPayout(@RequestBody UserPayoutVo requestVo){
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianPayoutDetailService.technicianPayout(technician,requestVo);
    }


    @ApiOperation("技师确认提现列表")
    @PostMapping("technicianConfirmPayout")
    @SaCheckLogin(type = "technician")
    public ApiRestResponse<List<ConfirmPayoutResponseVo>> technicianConfirmPayout() {
        Technician technician = technicianLoginUtil.getTechnician();
        return technicianPayoutDetailService.technicianConfirmPayout(technician);
    }

}
